-
Notifications
You must be signed in to change notification settings - Fork 174
Support os.Worker on Windows #1003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add thread create/join utility functions and use those to implement os.Worker on the operating system from Redmond.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Don't you need to solve the pipe used to signal messages from workers?
Yes. I should've probably opened this as a draft because I wanted to see what the CI does first. |
c8e29bd
to
355ec42
Compare
Some of the Windows buildbots have it, some don't. Grr... |
I'd be ok making it a requirement. Only the radare folks seemed to want to use an old enough MSVC not to support it. |
It's progress! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple of suggestions.
@@ -10,6 +10,17 @@ set(CMAKE_C_STANDARD_REQUIRED ON) | |||
set(CMAKE_C_EXTENSIONS ON) | |||
set(CMAKE_C_STANDARD 11) | |||
|
|||
# MINGW doesn't exist in older cmake versions, newer versions don't know |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, do you know what versions those are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I didn't mess up my notes: 3.22.1-1ubuntu1 (old), 3.31.6 (new)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know!
@@ -209,31 +209,6 @@ jobs: | |||
cl.exe /DJS_NAN_BOXING=0 /Zs cxxtest.cc | |||
cl.exe /DJS_NAN_BOXING=1 /Zs cxxtest.cc | |||
|
|||
windows-msvc-vs2019: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mention the requirement of atomics in https://quickjs-ng.github.io/quickjs/supported_platforms ?
quickjs-libc.c
Outdated
int write_fd; | ||
#endif | ||
} JSWaker; | ||
|
||
typedef struct { | ||
int ref_count; | ||
#ifdef USE_WORKER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't introduce this, but how about ifdef-ing the whole JSWorkerMessagePipe out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try that but I fully expect it to break the wasi build again.
#ifdef USE_WORKER | ||
static void js_waker_close(JSWaker *w) | ||
{ | ||
close(w->read_fd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset fds to -1?
DWORD ret, timeout = INFINITE; | ||
if (min_delay != -1) | ||
timeout = min_delay; | ||
ret = WaitForMultipleObjects(count, handles, FALSE, timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not want to explicitly check for WAIT_TIMEOUT for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary because WAIT_TIMEOUT is always > count. WaitForMultipleObjects can wait on 64 objects max, WAIT_TIMEOUT is bigger than that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha!
Add thread create/join utility functions and use those to implement os.Worker on the operating system from Redmond.